package com.coder.rental.security;

import cn.hutool.core.util.StrUtil;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

/**
 * @Author XueWenJie
 * @Date 2025/2/1
 * @Project auto_rental
 * 再写了passwordconfig之后，这个类没用了，可以删掉
 * 我再PasswordEncoder类用了@primary，这个注解是让spring自动注入并优先那个bean
 */
@Component
public class CustomerPasswordEncoder implements PasswordEncoder {

    @Override
    public String encode(CharSequence rawPassword) {
        return rawPassword.toString();
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return StrUtil.equals(encode(rawPassword),encodedPassword);
    }
}
